<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>填写购物信息</title>
<link rel="stylesheet" type="text/css" href="./Public/Home/css/FillInfo.css"/>
<script type="text/javascript" src="./Public/uploadify/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="./Public/Home/js/style.js"></script>
</head>
<body>
<header>
<!--顶层-->
	<div class="header_top">
		<div class="header_c">
			<?php if(isset($_SESSION['user'])) :?>
				<span>
				欢迎您，
				<a href="<?php echo U('Individual/index',['cid'=>$_GET['cid']])?>"><?php echo $user['account']?></a>！
				<a href="<?php echo U('Member/out')?>">[退出]</a>
				</span>
			<?php else :?>
				<span>
				<a href="<?php echo U('Member/index')?>">欢迎登录名鞋库</a>&nbsp;
				<a href="<?php echo U('Member/register')?>">免费注册</a>	
				</span>
			<?php endif ?>

			<ul class="h_menu">
				<!--<li class="li_left">
					<a href="">我的订单</a>					
				</li>-->
				<li class="li_left_w">
					<?php if(isset($_SESSION['user'])) :?>
					<p><a href="<?php echo U('Individual/index',['cid'=>$_GET['cid']])?>">我的名鞋库</a></p>
					<?php else :?>
					<p><a href="<?php echo U('Member/index')?>">我的名鞋库</a></p>	
					<?php endif ?>
					<!--<div class="show_hide">
						<a href="">我的订单</a>
						<a href="">密码管理</a>
					</div>-->
				</li>							
			</ul>
		</div>
	</div>
	<div class="warp">
		<div class="logo"></div>
	</div>
</header>

<!--详情-->
<nav id="box">
	<div class="wrap"></div>
	<div class="warp">
		<div class="check_out stepTit1"></div>
		<div class="add_function">
			<div class="addr_warp">
				<!--<table border="0" cellspacing="0" cellpadding="0">
					<tbody>
						<tr width: "100">
							<td>
								<em>*</em>
								收货地区：
							</td>
							<td>
								<select  name="" id="" >
								<option value="">请选择...</option>
								<option value="">北京</option>
								<option value="">上海</option>
								<option value="">天津</option>
								<option value="">河北</option>
								<option value="">河南</option>
								</select>
							</td>
							<td>-</td>
							<td>								
								<select  name="" id="" >
								<option value="">请选择...</option>
								<option value="">北京</option>
								<option value="">上海</option>
								<option value="">天津</option>
								<option value="">河北</option>
								<option value="">河南</option>
								</select>
							</td>							
							<td>[地区]&nbsp;</td>
							<td><input class="write_input" type="text" /></td>
						</tr>
						<tr>
							<td>
								<em>*</em>
								收货人姓名：
							</td>
							<td colspan="3">
								<input class="write_input" type="text" />
							</td>
						</tr>
						<tr>
							<td>
								<em>*</em>
								手机/固话：
							</td>
							<td colspan="3">
								<input class="write_input" type="text" />
							</td>
							<td colspan="2"><span>(固话填写格式，如:0591-2100000)</span></td>
						</tr>
						<tr>
							<td>
								<em>*</em>
								是否保存地址：
							</td>
							<td colspan="3" style="text-align: left;">
								<input class="save" type="checkbox" />
								保存本次收货地址
							</td>
						</tr>
					</tbody>
					
				</table>-->
			<script type="text/javascript">
				$(function(){
					//收货地址
					$('#ul li').click(function(){
						$(this).addClass('default_select').siblings().removeClass('default_select');
					});
					//送货方式(普通)
					$('.express_faa').click(function(){
						var fraa = $('.express_faa').val();
						$.ajax({
							type:"post",
							url:"<?php echo U('FillInfo/getExpress_faa')?>",
		        			data:{fraa:fraa},							
							dataType:'json',
							//服务器返回数据				
							success:function(phpData){
								console.log(phpData);									
								$('.express_price_total').html(phpData.expressPay);
								$('.price_total').html(phpData.goodsCarPrice);
								$('.price_total_hid').val(phpData.goodsPriceTotalHid);																
							}
						});
					})
					//送货方式(顺丰)
					$('.express_fee').click(function(){
						var free = $('.express_fee').val();
						$.ajax({
							type:"post",
							url:"<?php echo U('FillInfo/getExpress_fee')?>",
		        			data:{free:free},							
							dataType:'json',
							//服务器返回数据				
							success:function(phpData){
								console.log(phpData);									
								$('.express_price_total').html(phpData.expressPay);
								$('.price_total').html(phpData.goodsCarPrice);
								$('.price_total_hid').val(phpData.goodsPriceTotalHid);								
							}
						});
					})
					//提交订单发异步(订单表)
					$('#confirm_submit').click(function(){
						//获取用户选择地址id						
						var uaId = $('.default_select').attr('uaId');
						//获取快递方式
						var ex_price =	$('.express_price_total').html();
						//获取价格总价
//						var total_price = $('.price_total').html();
						var total_price = $('.price_total_hid').val();	
						//获取备注
						var remark = $('.order_mes_input').val();																		
						$.ajax({
							type:"post",
							url:"<?php echo U('Indent/getInfo')?>",
		        			data:{uaid:uaId,e:ex_price,remark:remark,total:total_price},							
							dataType:'json',
							//服务器返回数据				
							success:function(phpData){
								console.log(phpData);	
								//获取备注
								var explainString = [];
								$(".explain").each(function(){
			        				explainString.push($(this).val());
			    				});			    				
								//获取订单id
								var iid = phpData;	
								//提交订单发异步(订单列表)
								$.ajax({
									type:"post",
									url:"<?php echo U('Indent/getList')?>",
				        			data:{iid:iid,explain:explainString},							
									dataType:'json',
									//服务器返回数据				
									success:function(phpData){
										console.log(phpData);									
									}
								});																	
							}
						});
					})															
				})
			</script>
				<ul id="ul">
				<?php foreach ($addressData as $k=>$v){?>
					<li uaId="<?php echo $v['uaid']?>" <?php if($v['de_address'] == 1){?>
                class="default_select"
               <?php }?>>			
						<div class="add_hd">
							<?php echo $v['address'][0]?>
							<span>(<?php echo $v['uname']?>收)</span>
							<br />
						</div>
						<div class="add_bd">
							<span><?php echo $v['address'][1]?><?php echo $v['address'][2]?></span>
							<span><?php echo $v['address_detail']?></span>
						</div>						
						<span class="de_address">选择该地址</span>					
						<i></i>
					</li>
				<?php }?>							
				</ul>
			</div>
		</div>
		<div class="check_out stepTit2"></div>
		<div class="pay_method">
			<dl>
				<dt>付款方式</dt>
			</dl>
			<ul>
				<li>
					<input type="radio" name="pay" checked="checked"/>
					&nbsp;网上支付
					<span>可支持大多数银行、支付宝及财付通在线支付</span>
				</li>
				<!--<li>
					<input type="radio" name="pay"/>
					&nbsp;货到付款
					<span>由快递公司送货上门，您签收后，直接将货款交付给快递员</span>
				</li>-->
			</ul>
			<dl>
				<dt>送货方式</dt>
			</dl>
			<ul>
				<li>
					<input class="express_faa" type="radio" name="ship" checked="checked" value="8"/>
					&nbsp;普通快递 
					<span class="money"> ￥8.00 </span>
					<!--在线支付会员满399免邮！-->
					<span>送货方式默认发普通快递，快递送达时间：2-4个工作日 送货范围：全国 (台湾，香港，澳门除外)</span>
				</li>
				<li>
					<input class="express_fee" type="radio" name="ship" value="15"/>
					&nbsp;顺丰 
					<span class="money" style="margin-left: 43px;"> ￥15.00 </span>
					<span>选择货到付款将默认发顺丰， 不到达的地区自动转为宅急送等其他快递。在线支付选择顺丰加急， 需要补差价。</span>
				</li>
			</ul>			
		</div>
		<div class="check_out stepTit3"></div>
		<!--**********************************************************************-->	
		<div class="car_body">
			<div class="cart_tb_head">	
				<table border="0" cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<th style="width:380px">商品信息</th>
							<th style="width: 95px">赠送积分</th>
							<th style="width: 95px">销售价格</th>
							<th style="width: 95px">数量</th>
							<!--<th style="width: 95px">折扣/优惠</th>-->
							<th style="width: 95px">小计</th>
							<th style="width: 125px">备注说明</th>
						</tr>
					</tbody>	
				</table>
			</div>
			<table class="goods_car" border="0" cellspacing="0" cellpadding="0">
				<tbody>
					<tr >
						<th style="width:380px"></th>
						<th style="width: 95px"></th>
						<th style="width: 95px"></th>
						<th style="width: 95px"></th>
						<th style="width: 95px"></th>
						<th style="width: 125px"></th>
					</tr>
					<?php foreach ($goodsCarData as $k=>$v){?>
					<tr>
						<td>
							<a class="goods_pic" href="">
								<img src="<?php echo $v['picture']?>"/>
							</a>								
							<a class="goods_cont" href="">
								<?php echo $v['name']?>
								<p>( 
									<?php foreach ($v['options'] as $kk=>$vv){?>
										<?php echo $kk?>:<?php echo $vv?>,
									<?php }?>
								)</p>
							</a>															
						</td>
						<!--赠送积分-->
						<td>
							0
						</td>
						<!--销售价格-->
						<td class="money">
							￥<?php echo $v['price']?>
						</td>
						<!--数量-->
						<td>
							<?php echo $v['num']?>
						</td>
						<!--折扣/优惠-->
						<!--<td class="money">
							-￥60.00
						</td>-->
						<!--小计-->
						<td class="money">
							￥<?php echo $v['total']?>
						</td>
						<td>
							<textarea class="explain" rows="2" cols="14" value=""></textarea>
						</td>
					</tr>
					<?php }?>
				</tbody>					
			</table>
			<div class="row"></div>
		</div>

		<div class="end_checkout">
			<div class="order_remark">
				<span>
					<i class="order_mes"></i>订单附言
				</span>
				<span>
					<input name="remark" class="order_mes_input" type="text" />
				</span>
			</div>
			<div class="bill">
				<table border="0" cellspacing="0" cellpadding="0">
					<tbody>
						<tr>
							<td align="right">商品原总价：</td>
							<td class="money" align="left">￥<?php echo $goodsCarPrice?></td>
						</tr>
						<tr>
							<td align="right">运费：</td>
							<td class="money" align="left">
								<span>￥</span>
								<span class="express_price_total">8.00</span>
							</td>
						</tr>
						<!--<tr>
							<td align="right">优惠金额：</td>
							<td class="money" align="left">-￥60.00</td>
						</tr>-->
						<tr>
							<td align="right">您共需要支付：</td>
							<td class="c_total" align="left">
								<span>￥</span>
								<span class="price_total"><?php echo $goodsPriceTotal?></span>	
								<input type="hidden" class="price_total_hid" value="<?php echo $goodsPriceTotalHid?>" />							
							</td>
						</tr>
					</tbody>				
				</table>
			</div>		
		</div>
		<div class="cart_check_act">
			<a class="cart_goBuy" href="<?php echo U('Index/index')?>">
				<i></i>继续购物
			</a>
			<a href="<?php echo U('OrderSuccess/index')?>">
				<input id="confirm_submit" type="submit" value="确认，提交订单"/>
			</a>
		</div>
	</div>	
</nav>

<!--载入公共模板-->


<footer>
	<div class="foot_row">
		<div class="row">
			<div class="row_one">
				<!--版权-->
				<p>Copyright © 2016-09</p>
			</div>
			<div class="row_one">
				<!--备案号-->
				<p>云ICP备00000000号</p>
			</div>
			<div class="row_one">
				<!--网站信息-->
				<p>名鞋库 All Rights Reserved. </p>
			</div>
			<div class="row_one">
				<!--经营许可证-->
				<p>经营许可证云YN-0000000  </p>
			</div>
		</div>
		
		<div class="link">			
			<div class="Foot6">
				友情链接：
				<ul class="Foot7">
					<!--链接为5个，要改注意该js-->
					<li><a class="Foot6_text"href="https://www.baidu.com/">百度</a></li>
					<li><a class="Foot6_text"href="http://www.jd.com/">京东</a></li>					
					<li><a class="Foot6_text"href="https://www.taobao.com//">淘宝</a></li>					
					<li><a class="Foot6_text"href="https://www.tianmao.com//">天猫</a></li>					
				</ul>		
			</div>			
		</div>
	</div>
</footer>